package org.learn.config;

import org.learn.filter.TestFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    /*使用方式2时将其注释放开*/
   /* @Bean //将方法中返回的对象注入到IOC容器中
    public FilterRegistrationBean filterRegiste(){
        FilterRegistrationBean reFilter = new FilterRegistrationBean();
        reFilter.setFilter(new TestFilter()); //创建并注册TestFilter
        reFilter.addUrlPatterns("/*"); //拦截的路径（对所有请求拦截）
        reFilter.setName("TestFilter"); //拦截器的名称
        reFilter.setOrder(1); //拦截器的执行顺序。数字越小越先执行
        return  reFilter;

    }*/
}
